﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abp.Domain.Repositories;

namespace Xugege.AbpExtension.Core.Extension.DataManager
{
    public class DataDictionaryManager : IDataDictionaryManager
    {
        
        private readonly IRepository<DataDictionary, long> _dictionaryService;

        public DataDictionaryManager(IRepository<DataDictionary, long> dictionaryService)
        {
            _dictionaryService = dictionaryService;
        }

        /// <summary>
        /// 通过类别获取字典数据列表
        /// </summary>
        /// <param name="categoryCode"></param>
        /// <returns></returns>
        public IList<DataDictionary> GetByCategory(string categoryCode)
        {
            return _dictionaryService.GetAll().Where(m => m.CategoryCode == categoryCode).ToList();
        }
    }
}
